<?php
class commodity_model extends CI_Model {
	function __construct() {
		parent::__construct();
	}

// 	public function gets($page, $rp) {
// 		// オブジェクト

// 		$sql="select * from commodity_header ";
// 		$sql.= 'limit '.$page.', '.$rp;
// 		$rs = $this->db->query($sql);
// 		//return $rs->result_array();
// 		return $rs->result();

// // 		return $this->db->query("select * from test")->result_array();
// 	}
// 	public function gets_total() {
// 		// オブジェクト
// 		$rs = $this->db->query("select * from commodity_header");
// 		return $rs->num_rows();
// 		// 		return $this->db->query("select * from test")->result_array();
// 	}

	public function get($commodity_code) {
		// オブジェクト
// 		return $this->db->get_where('commodity', array('id'=>$test_id))->row();
		return $this->db->get_where('commodity_detail', array('commodity_code'=>$commodity_code))->result();
		// 		return $this->db->query("select * from test")->result_array();
	}

	public function lists($commodity_code) {
		// オブジェクト
		// 		return $this->db->get_where('commodity', array('id'=>$test_id))->row();
		return $this->db->get_where('commodity_detail', array('commodity_code'=>$commodity_code))->result();
		// 		return $this->db->query("select * from test")->result_array();
	}

	public function get_description($commodity_code) {
		// オブジェクト
		// 		return $this->db->get_where('commodity', array('id'=>$test_id))->row();
		return $this->db->get_where('commodity_description', array('commodity_code'=>$commodity_code))->result();
		// 		return $this->db->query("select * from test")->result_array();
	}

}
